import request from '@/config/axios'

export const createComment = async (data: any) => {
  return await request.post({ url: `/product/comment/create`, data })
}
export const getCommentList = async (params: any) => {
  return await request.get({ url: `/product/comment/page`, params })
}
// /product/comment/update
export const updateComment = async (data: any) => {
  return await request.post({ url: `/product/comment/update`, data })
}
// /product/comment/get
export const getComment = async (params: any) => {
  return await request.get({ url: `/product/comment/get`, params })
}
// /product/comment/deleteList
export const deleteComment = async (id: any) => {
  return await request.delete({ url: `/product/comment/deleteList?ids=` + id })
}
// 导出商品评论 Excel
export const exportComment = async (params: any) => {
  return await request.download({ url: `/product/comment/exportExcel`, params })
}
// /product/comment/import
// 导入商品评论
export const importComment = async (file: File) => {
  const formData = new FormData() // 创建 FormData 对象
  formData.append('file', file) // 将文件添加到 FormData
  return await request.post({
    url: `/product/comment/import`,
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data' // 确保设置正确的 Content-Type
    }
  })
}
